package com.zyb.oss.controller;

import com.zyb.commonutils.R;
import com.zyb.oss.service.OSSService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "/eduoss/fileoss")
//CrossOrigin
public class OSSController {

    @Resource
    private OSSService ossService;

    @PostMapping
    public R uploadFile(MultipartFile file){
        String url=ossService.uploadFileAvatar(file);
        return R.ok().data("url",url);
    }
}
